package com.lcf.system.service;

import com.lcf.framework.utils.FileUtils;
import com.lcf.framework.utils.oss.OssUtils;
import com.lcf.system.vo.file.FileShowVO;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件上传
 *
 * @author lcf
 */
@Service
public class FileUploadService {
    /**
     * 图片上传
     */
    public FileShowVO uploadImg(String bucket, MultipartFile file, boolean isCompress) {
        return new FileShowVO(FileUtils.getFileName(file.getOriginalFilename()), OssUtils.uploadImg(bucket, file, isCompress));
    }

    /**
     * 文件上传
     */
    public FileShowVO uploadFile(String bucket, MultipartFile file) {
        return new FileShowVO(FileUtils.getFileName(file.getOriginalFilename()), OssUtils.uploadFile(bucket, file));
    }
}
